package com.ordb.lernen;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.*;
import sqlj.runtime;
#sql iterator KundenIter( String Name);
public class SqljStatic {

	/**
	 * @param args
	 * @throws ClassNotFoundException 
	 * @throws SQLException 
	 */
	public Connection getConnToDb() throws ClassNotFoundException, SQLException{
		Class.forName("oracle.jdbc.driver.OracleDriver");
		Connection con = DriverManager.getConnection("jdbc:oracle:thin:@172.16.241.134:1521:XE","SYSTEM","jojojo");
		return con;
		
	}
	
	
	public static void main(String[] args) {
		
	
		public class Kunden
		{
		public static void main(String argv[])
		{
		... // lade passenden Treiber und stelle DB-Verbindung her
		KundenIter kunde;
		#sql kunde = { SELECT KNr, Name FROM Kunde };
		while (kunde.next())
		System.out.println(kunde.KNr() + ", " + kunde.Name());
		kunde.close();
		}
		}

	}

}
